package com.chris.core.socket.netty.run;

import com.chris.core.socket.netty.dto.SocketTypeEnum;
import com.chris.core.socket.netty.handler.ObjectClientHandler;
import com.chris.core.socket.netty.util.NettyClientUtil;
import com.chris.core.socket.netty.util.NettyRunTimeUtil;
import io.netty.channel.ChannelPipeline;

@Deprecated
public class NettyObjectClient {
    public static void main(String[] args) throws InterruptedException {

        NettyRunTimeUtil.runTimeBreakMark="\r\n";
        NettyClientUtil service = new NettyClientUtil("127.0.0.1",10105,180,NettyRunTimeUtil.runTimeBreakMark,false, SocketTypeEnum.ObjectSocket) {
            @Override
            public void AddChannelHandler(ChannelPipeline pipeline) {

                //自定义事件
                pipeline.addLast(new ObjectClientHandler());
            }
        };

        service.Open();

        Thread.sleep(6000);

        System.out.println("发送测试内容");

       // TransferDataDTO  dto = new TransferDataDTO("msg","我上线了");
        service.sendObjMsg("ob->string:文本测试");

       // service.sendObjMsg(dto);
/*
        service.sendObjMsg("ob->string:文本测试");
        byte[] bytes = new byte[2];
        bytes[0]=1;
        bytes[1]=2;
        service.sendObjMsg(new byte[2]);
        service.sendObjMsg(1);
        service.sendObjMsg("2");
        service.sendObjMsg(3L);
        service.sendObjMsg(4.0);



        File file = new File("./tip.log");
        service.sendFileMsg(file);
         */

/*

        while (true)
        {

        } */
    }


}
